home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 April / Chip CMCD0400.iso / SOFTWARE / Freeware / Programare / Bass / BASS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1999-07-23  |  34.4 KB  |  732 lines

  1. /* BASS 0.6 C/C++ header file, copyright (c) 1999 Ian Luck.
  2.    Please report bugs/suggestions/etc... to bass@icl.ndirect.co.uk */
  3.  
  4. #ifndef BASS_H
  5. #define BASS_H
  6.  
  7. #include <wtypes.h>
  8.  
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. #ifndef BASSDEF
  14. #define BASSDEF(f) WINAPI f
  15. #endif
  16.  
  17. typedef DWORD HMUSIC;        // MOD music handle
  18. typedef DWORD HSAMPLE;        // sample handle
  19. typedef DWORD HCHANNEL;        // playing sample's channel handle
  20. typedef DWORD HSTREAM;        // sample stream handle
  21. typedef DWORD HSYNC;        // synchronizer handle
  22.  
  23. // Error codes returned by BASS_GetErrorCode()
  24. #define BASS_OK                0    // all is OK
  25. #define BASS_ERROR_MEM        1    // memory error
  26. #define BASS_ERROR_FILEOPEN    2    // can't open the file
  27. #define BASS_ERROR_DRIVER    3    // can't find a free sound driver
  28. #define BASS_ERROR_BUFLOST    4    // the sample buffer was lost - please report this!
  29. #define BASS_ERROR_HANDLE    5    // invalid handle
  30. #define BASS_ERROR_FORMAT    6    // unsupported format
  31. #define BASS_ERROR_POSITION    7    // invalid playback position
  32. #define BASS_ERROR_INIT        8    // BASS_Init has not been successfully called
  33. #define BASS_ERROR_START    9    // BASS_Start has not been successfully called
  34. #define BASS_ERROR_INITCD    10    // can't initialize CD
  35. #define BASS_ERROR_CDINIT    11    // BASS_CDInit has not been successfully called
  36. #define BASS_ERROR_NOCD        12    // no CD in drive
  37. #define BASS_ERROR_CDTRACK    13    // can't play the selected CD track
  38. #define BASS_ERROR_ALREADY    14    // already initialized
  39. #define BASS_ERROR_CDVOL    15    // CD has no volume control
  40. #define BASS_ERROR_NOPAUSE    16    // not paused
  41. #define BASS_ERROR_NOTAUDIO    17    // not an audio track
  42. #define BASS_ERROR_NOCHAN    18    // can't get a free channel
  43. #define BASS_ERROR_ILLTYPE    19    // an illegal type was specified
  44. #define BASS_ERROR_ILLPARAM    20    // an illegal parameter was specified
  45. #define BASS_ERROR_NO3D        21    // no 3D support
  46. #define BASS_ERROR_NOEAX    22    // no EAX support
  47. #define BASS_ERROR_DEVICE    23    // illegal device number
  48. #define BASS_ERROR_NOPLAY    24    // not playing
  49. #define BASS_ERROR_UNKNOWN    -1    // some other mystery error
  50.  
  51. // Device setup flags
  52. #define BASS_DEVICE_8BITS    1    // use 8 bit resolution, else 16 bit
  53. #define BASS_DEVICE_MONO    2    // use mono, else stereo
  54. #define BASS_DEVICE_3D        4    // enable 3D functionality
  55. /* If the BASS_DEVICE_3D flag is not specified when initilizing BASS,
  56. then the 3D flags (BASS_SAMPLE_3D and BASS_MUSIC_3D) are ignored when
  57. loading/creating a sample/stream/music. */
  58.  
  59. typedef struct {
  60.     DWORD size;        // size of this struct (set this before calling the function)
  61.     DWORD flags;    // device capabilities (DSCAPS_xxx flags)
  62. /* The following values are irrelevant if the device doesn't have hardware
  63. support (DSCAPS_EMULDRIVER is specified in flags) */
  64.     DWORD hwsize;    // size of total device hardware memory
  65.     DWORD hwfree;    // size of free device hardware memory
  66.     DWORD freesam;    // number of free sample slots in the hardware
  67.     DWORD free3d;    // number of free 3D sample slots in the hardware
  68.     DWORD minrate;    // min sample rate supported by the hardware
  69.     DWORD maxrate;    // max sample rate supported by the hardware
  70.     BOOL eax;        // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
  71. } BASS_INFO;
  72.  
  73. // BASS_INFO flags (from DSOUND.H)
  74. #define DSCAPS_CONTINUOUSRATE    0x00000010
  75. /* supports all sample rates between min/maxrate */
  76. #define DSCAPS_EMULDRIVER        0x00000020
  77. /* device does NOT have hardware DirectSound support */
  78. #define DSCAPS_CERTIFIED        0x00000040
  79. /* device driver has been certified by Microsoft */
  80. /* The following flags tell what type of samples are supported by HARDWARE
  81. mixing, all these formats are supported by SOFTWARE mixing */
  82. #define DSCAPS_SECONDARYMONO    0x00000100    // mono
  83. #define DSCAPS_SECONDARYSTEREO    0x00000200    // stereo
  84. #define DSCAPS_SECONDARY8BIT    0x00000400    // 8 bit
  85. #define DSCAPS_SECONDARY16BIT    0x00000800    // 16 bit
  86.  
  87. // Volume sliding flags
  88. #define BASS_SLIDE_DIGITAL    1    // slide digital master volume
  89. #define BASS_SLIDE_CD        2    // slide CD volume
  90.  
  91. // Music flags
  92. #define BASS_MUSIC_RAMP        1    // normal ramping
  93. #define BASS_MUSIC_RAMPS    2    // sensitive ramping
  94. /* Ramping doesn't take a lot of extra processing and improves
  95. the sound quality by removing "clicks". Sensitive ramping will
  96. leave sharp attacked samples, unlike normal ramping. */
  97. #define BASS_MUSIC_LOOP        4    // loop music
  98. #define BASS_MUSIC_FT2MOD    16    // play .MOD as FastTracker 2 does
  99. #define BASS_MUSIC_PT1MOD    32    // play .MOD as ProTracker 1 does
  100. #define BASS_MUSIC_MONO        64    // force mono mixing (less CPU usage)
  101. #define BASS_MUSIC_3D        128    // enable 3D functionality
  102.  
  103. // Sample info structure & flags
  104. typedef struct {
  105.     DWORD freq;        // default playback rate
  106.     DWORD volume;    // default volume (0-100)
  107.     int pan;        // default pan (-100=left, 0=middle, 100=right)
  108.     DWORD flags;    // BASS_SAMPLE_xxx flags
  109.     DWORD length;    // length (in samples, not bytes)
  110.     DWORD max;        // maximum simultaneous playbacks
  111. /* The following are the sample's default 3D attributes (if the sample
  112. is 3D, BASS_SAMPLE_3D is in flags) see BASS_ChannelSet3DAttributes */
  113.     DWORD mode3d;    // BASS_3DMODE_xxx mode
  114.     float mindist;    // minimum distance
  115.     float maxdist;    // maximum distance
  116.     DWORD iangle;    // angle of inside projection cone
  117.     DWORD oangle;    // angle of outside projection cone
  118.     DWORD outvol;    // delta-volume outside the projection cone
  119. } BASS_SAMPLE;
  120.  
  121. #define BASS_SAMPLE_8BITS        1    // 8 bit, else 16 bit
  122. #define BASS_SAMPLE_MONO        2    // mono, else stereo
  123. #define BASS_SAMPLE_LOOP        4    // looped
  124. #define BASS_SAMPLE_3D            8    // 3D functionality enabled
  125. #define BASS_SAMPLE_SOFTWARE    16    // it's NOT using hardware mixing
  126. #define BASS_SAMPLE_OVER_VOL    0x10000    // override lowest volume
  127. #define BASS_SAMPLE_OVER_POS    0x20000    // override longest playing
  128. #define BASS_SAMPLE_OVER_DIST    0x30000 // override furthest from listener (3D only)
  129.  
  130. #define BASS_MP3_HALFRATE    0x10000 // reduced quality MP3 (half sample rate)
  131.  
  132. // 3D vector (for 3D positions/velocities/orientations)
  133. typedef struct {
  134.     float x;    // +=right, -=left
  135.     float y;    // +=up, -=down
  136.     float z;    // +=front, -=behind
  137. } BASS_3DVECTOR;
  138.  
  139. // 3D channel modes
  140. #define BASS_3DMODE_NORMAL        0
  141. /* normal 3D processing */
  142. #define BASS_3DMODE_RELATIVE    1
  143. /* The channel's 3D position (position/velocity/orientation) are relative to
  144. the listener. When the listener's position/velocity/orientation is changed
  145. with BASS_Set3DPosition, the channel's position relative to the listener does
  146. not change. */
  147. #define BASS_3DMODE_OFF            2
  148. /* Turn off 3D processing on the channel, the sound will be played
  149. in the center. */
  150.  
  151. // EAX environments, use with BASS_SetEAXParameters
  152. enum
  153. {
  154.     EAX_ENVIRONMENT_GENERIC,
  155.     EAX_ENVIRONMENT_PADDEDCELL,
  156.     EAX_ENVIRONMENT_ROOM,
  157.     EAX_ENVIRONMENT_BATHROOM,
  158.     EAX_ENVIRONMENT_LIVINGROOM,
  159.     EAX_ENVIRONMENT_STONEROOM,
  160.     EAX_ENVIRONMENT_AUDITORIUM,
  161.     EAX_ENVIRONMENT_CONCERTHALL,
  162.     EAX_ENVIRONMENT_CAVE,
  163.     EAX_ENVIRONMENT_ARENA,
  164.     EAX_ENVIRONMENT_HANGAR,
  165.     EAX_ENVIRONMENT_CARPETEDHALLWAY,
  166.     EAX_ENVIRONMENT_HALLWAY,
  167.     EAX_ENVIRONMENT_STONECORRIDOR,
  168.     EAX_ENVIRONMENT_ALLEY,
  169.     EAX_ENVIRONMENT_FOREST,
  170.     EAX_ENVIRONMENT_CITY,
  171.     EAX_ENVIRONMENT_MOUNTAINS,
  172.     EAX_ENVIRONMENT_QUARRY,
  173.     EAX_ENVIRONMENT_PLAIN,
  174.     EAX_ENVIRONMENT_PARKINGLOT,
  175.     EAX_ENVIRONMENT_SEWERPIPE,
  176.     EAX_ENVIRONMENT_UNDERWATER,
  177.     EAX_ENVIRONMENT_DRUGGED,
  178.     EAX_ENVIRONMENT_DIZZY,
  179.     EAX_ENVIRONMENT_PSYCHOTIC,
  180.  
  181.     EAX_ENVIRONMENT_COUNT            // total number of environments
  182. };
  183.  
  184. // EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
  185. #define EAX_PRESET_GENERIC         EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
  186. #define EAX_PRESET_PADDEDCELL      EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
  187. #define EAX_PRESET_ROOM            EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
  188. #define EAX_PRESET_BATHROOM        EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
  189. #define EAX_PRESET_LIVINGROOM      EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
  190. #define EAX_PRESET_STONEROOM       EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
  191. #define EAX_PRESET_AUDITORIUM      EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
  192. #define EAX_PRESET_CONCERTHALL     EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
  193. #define EAX_PRESET_CAVE            EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
  194. #define EAX_PRESET_ARENA           EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
  195. #define EAX_PRESET_HANGAR          EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
  196. #define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
  197. #define EAX_PRESET_HALLWAY         EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
  198. #define EAX_PRESET_STONECORRIDOR   EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
  199. #define EAX_PRESET_ALLEY           EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
  200. #define EAX_PRESET_FOREST          EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
  201. #define EAX_PRESET_CITY            EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
  202. #define EAX_PRESET_MOUNTAINS       EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
  203. #define EAX_PRESET_QUARRY          EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
  204. #define EAX_PRESET_PLAIN           EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
  205. #define EAX_PRESET_PARKINGLOT      EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
  206. #define EAX_PRESET_SEWERPIPE       EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
  207. #define EAX_PRESET_UNDERWATER      EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
  208. #define EAX_PRESET_DRUGGED         EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
  209. #define EAX_PRESET_DIZZY           EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
  210. #define EAX_PRESET_PSYCHOTIC       EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F
  211.  
  212. typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length);
  213. /* Stream callback function. NOTE: A stream function should obviously be as quick
  214. as possible, other streams (and MOD musics) can't be mixed until it's finished.
  215. handle : The stream that needs writing
  216. buffer : Buffer to write the samples in
  217. length : Number of bytes to write
  218. RETURN : Number of bytes written. If less than "length" then the
  219.          stream is assumed to be at the end, and is stopped. */
  220.  
  221. /* Sync types (with BASS_ChannelSetSync() "param" and SYNCPROC "data"
  222. definitions) & flags. */
  223. #define BASS_SYNC_MUSICPOS    0
  224. /* Sync when a music reaches a position.
  225. param: LOWORD=order (0=first, -1=all) HIWORD=row (0=first, -1=all)
  226. data : LOWORD=order HIWORD=row */
  227. #define BASS_SYNC_MUSICINST    1
  228. /* Sync when an instrument (sample for the non-instrument based formats)
  229. is played in a music (not including retrigs).
  230. param: LOWORD=instrument (1=first) HIWORD=note (0=c0...119=b9, -1=all)
  231. data : LOWORD=note HIWORD=volume (0-64) */
  232. #define BASS_SYNC_END        2
  233. /* Sync when a music or file stream reaches the end.
  234. param: not used
  235. data : not used */
  236. #define BASS_SYNC_ONETIME    0x80000000    // FLAG: sync only once, else continuously
  237.  
  238. typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data);
  239. /* Sync callback function. NOTE: a sync callback function should be very
  240. quick (eg. just posting a message) as other syncs cannot be processed
  241. until it has finished.
  242. handle : The sync that has occured
  243. channel: Channel that the sync occured in (HMUSIC)
  244. data   : Additional data associated with the sync's occurance */
  245.  
  246. #define CDCHANNEL    0    // CD channel, for use with BASS_Channel functions
  247.  
  248. DWORD BASSDEF(BASS_GetVersion)();
  249. /* Retrieve the version number of BASS that is loaded.
  250. RETURN : The BASS version (LOWORD.HIWORD) */
  251.  
  252. BOOL BASSDEF(BASS_GetDeviceDescription)(int devnum, char **desc);
  253. /* Get the text description of a device. This function can be used to
  254. enumerate the available devices.
  255. devnum : The device (0=first)
  256. desc   : Pointer to store pointer to text description at */
  257.  
  258. void BASSDEF(BASS_SetBufferLength)(float length);
  259. /* Set the amount that BASS mixes ahead new musics/streams. Changing
  260. this setting does not affect musics/streams that have already been
  261. loaded/created. Increasing the buffer length, decreases the chance of
  262. the sound possibly breaking-up on slower computers, but also requires
  263. more memory. The default length is 0.5 secs.
  264. length : The buffer length in seconds (limited to 0.3-2.0s)
  265.  
  266. NOTE: This setting does not represent the latency (delay between playing
  267. and hearing the sound). The latency depends on the drivers, the power of
  268. the CPU, and the complexity of what's being mixed (eg. an IT using filters
  269. requires more processing than a plain 4 channel MOD). So the buffer length
  270. actually has no effect on the latency. */
  271.  
  272. void BASSDEF(BASS_SetGlobalVolumes)(int musvol, int samvol, int strvol);
  273. /* Set the global music/sample/stream volume levels.
  274. musvol : MOD music global volume level (0-100, -1=leave current)
  275. samvol : Sample global volume level (0-100, -1=leave current)
  276. strvol : Stream global volume level (0-100, -1=leave current) */
  277.  
  278. void BASSDEF(BASS_GetGlobalVolumes)(DWORD *musvol, DWORD *samvol, DWORD *strvol);
  279. /* Retrive the global music/sample/stream volume levels.
  280. musvol : MOD music global volume level (NULL=don't retrieve it)
  281. samvol : Sample global volume level (NULL=don't retrieve it)
  282. strvol : Stream global volume level (NULL=don't retrieve it) */
  283.  
  284. DWORD BASSDEF(BASS_ErrorGetCode)();
  285. /* Get the BASS_ERROR_xxx error code. Use this function to get the
  286. reason for an error. */
  287.  
  288.  
  289. BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win);
  290. /* Initialize the digital output. This must be called before all following
  291. BASS functions (except CD functions). The volume is initially set to 100
  292. (the maximum), use BASS_SetVolume() to adjust it.
  293. device : Device to use (0=first, -1=default, -2=no sound)
  294. freq   : Output sample rate
  295. flags  : BASS_DEVICE_xxx flags
  296. win    : Owner window
  297.  
  298. NOTE: The "no sound" device (device=-2), allows loading and "playing"
  299. of MOD musics only (all sample/stream functions and most other functions
  300. fail). This is so that you can still use the MOD musics as synchronizers
  301. when there is no soundcard present. When using device -2, you should still
  302. set the other arguments as you would do normally. */
  303.  
  304. void BASSDEF(BASS_Free)();
  305. /* Free all resources used by the digital output, including all musics
  306. and samples. */
  307.  
  308. void BASSDEF(BASS_GetInfo)(BASS_INFO *info);
  309. /* Retrieve some information on the device being used.
  310. info   : Pointer to store info at */
  311.  
  312. DWORD BASSDEF(BASS_GetCPU)();
  313. /* Get the current CPU usage of BASS. This includes the time taken to
  314. mix the MOD musics and sample streams. It does not include plain sample
  315. mixing which is done by the output device (hardware accelerated) or
  316. DirectSound (emulated). Audio CD playback requires no CPU usage.
  317. RETURN : The CPU usage percentage */
  318.  
  319. BOOL BASSDEF(BASS_Start)();
  320. /* Start the digital output. */
  321.  
  322. BOOL BASSDEF(BASS_Stop)();
  323. /* Stop the digital output, stopping all musics/samples/streams. */
  324.  
  325. BOOL BASSDEF(BASS_Pause)();
  326. /* Stop the digital output, pausing all musics/samples/streams. Use
  327. BASS_Start() to resume the digital output. */
  328.  
  329. BOOL BASSDEF(BASS_SetVolume)(DWORD volume);
  330. /* Set the digital output master volume.
  331. volume : Desired volume level (0-100) */
  332.  
  333. int BASSDEF(BASS_GetVolume)();
  334. /* Get the digital output master volume.
  335. RETURN : The volume level (0-100, -1=error) */
  336.  
  337. BOOL BASSDEF(BASS_SlideVolume)(DWORD volume, DWORD period, DWORD mode);
  338. /* Slide the digital output master volume and/or the CD volume from
  339. the current level to the target level.
  340. volume : Target volume (0-100)
  341. period : Delay (in msec) between each volume step, example: from 0
  342.          to 100 with 20ms period = 100x20ms = 2 sec total period
  343. mode   : Digital and/or CD volume flags (BASS_SLIDE_xxx flags)*/
  344.  
  345. BOOL BASSDEF(BASS_IsSliding)();
  346. /* Check if the digital output master volume and/or the CD volume
  347. is sliding. */
  348.  
  349. BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf);
  350. /* Set the factors that affect the calculations of 3D sound.
  351. distf  : Distance factor (0.0-10.0, 1.0=use meters, 0.3=use feet, <0.0=leave current)
  352.          By default BASS measures distances in meters, you can change this
  353.          setting if you are using a different unit of measurement.
  354. roolf  : Rolloff factor, how fast the sound quietens with distance
  355.          (0.0=no rolloff, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
  356. doppf  : Doppler factor (0.0=no doppler, 1.0=real world, 2.0=2x real... 10.0=max, <0.0=leave current)
  357.          The doppler effect is the way a sound appears to change frequency when it is
  358.          moving towards or away from you. The listener and sound velocity settings are
  359.          used to calculate this effect, this "doppf" value can be used to lessen or
  360.          exaggerate the effect. */
  361.  
  362. BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf);
  363. /* Get the factors that affect the calculations of 3D sound.
  364. distf  : Distance factor (NULL=don't get it)
  365. roolf  : Rolloff factor (NULL=don't get it)
  366. doppf  : Doppler factor (NULL=don't get it) */
  367.  
  368. BOOL BASSDEF(BASS_Set3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
  369. /* Set the position/velocity/orientation of the listener (ie. the player/viewer).
  370. pos    : Position of the listener (NULL=leave current)
  371. vel    : Listener's velocity, used to calculate doppler effect (NULL=leave current)
  372. front  : Direction that listener's front is pointing (NULL=leave current)
  373. top    : Direction that listener's top is pointing (NULL=leave current)
  374.          NOTE: front & top must both be set in a single call */
  375.  
  376. BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
  377. /* Get the position/velocity/orientation of the listener.
  378. pos    : Position of the listener (NULL=don't get it)
  379. vel    : Listener's velocity (NULL=don't get it)
  380. front  : Direction that listener's front is pointing (NULL=don't get it)
  381. top    : Direction that listener's top is pointing (NULL=don't get it)
  382.          NOTE: front & top must both be retrieved in a single call */
  383.  
  384. BOOL BASSDEF(BASS_Apply3D)();
  385. /* Apply changes made to the 3D system. This must be called to apply any changes
  386. made with BASS_Set3DFactors, BASS_Set3DPosition, BASS_ChannelSet3DAttributes or
  387. BASS_ChannelSet3DPosition. It improves performance to have DirectSound do all the
  388. required recalculating at the same time like this, rather than recalculating after
  389. every little change is made. NOTE: This is automatically called when starting a 3D
  390. sample with BASS_SamplePlay3D/Ex. */
  391.  
  392. BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp);
  393. /* Set the type of EAX environment and it's parameters. Obviously, EAX functions
  394. have no effect if no EAX supporting device (ie. SB Live) is used.
  395. env    : Reverb environment (EAX_ENVIRONMENT_xxx, -1=leave current)
  396. vol    : Volume of the reverb (0.0=off, 1.0=max, <0.0=leave current)
  397. decay  : Time in seconds it takes the reverb to diminish by 60dB (0.1-20.0, <0.0=leave current)
  398. damp   : The damping, high or low frequencies decay faster (0.0=high decays quickest,
  399.          1.0=low/high decay equally, 2.0=low decays quickest, <0.0=leave current) */
  400.  
  401. BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp);
  402. /* Get the current EAX parameters.
  403. env    : Reverb environment (NULL=don't get it)
  404. vol    : Reverb volume (NULL=don't get it)
  405. decay  : Decay duration (NULL=don't get it)
  406. damp   : The damping (NULL=don't get it) */
  407.  
  408.  
  409. HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, void *file, DWORD offset, DWORD length, DWORD flags);
  410. /* Load a music (XM/MOD/S3M/IT/MTM). The amplification and pan
  411. seperation are initially set to 50, use BASS_MusicSetAmplify()
  412. and BASS_MusicSetPanSep() to adjust them.
  413. mem    : TRUE = Load music from memory
  414. file   : Filename (mem=FALSE) or memory location (mem=TRUE)
  415. offset : File offset to load the music from (only used if mem=FALSE)
  416. length : Data length (only used if mem=FALSE, 0=use to end of file)
  417. flags  : BASS_MUSIC_xxx flags
  418. RETURN : The loaded music's handle (NULL=error) */
  419.  
  420. void BASSDEF(BASS_MusicFree)(HMUSIC handle);
  421. /* Free a music's resources.
  422. handle : Music handle */
  423.  
  424. BOOL BASSDEF(BASS_MusicPlay)(HMUSIC handle);
  425. /* Play a music. Playback continues from where it was last stopped/paused.
  426. Multiple musics may be played simultaneously.
  427. handle : Handle of music to play */
  428.  
  429. BOOL BASSDEF(BASS_MusicPlayEx)(HMUSIC handle, DWORD pos, int flags, BOOL reset);
  430. /* Play a music, specifying start position and playback flags.
  431. handle : Handle of music to play
  432. pos    : Position to start playback from, LOWORD=order HIWORD=row
  433. flags  : BASS_MUSIC_xxx flags. These flags overwrite the defaults
  434.          specified when the music was loaded. (-1=use current flags)
  435. reset  : TRUE = Stop all current playing notes and reset bpm/etc... */
  436.  
  437. BOOL BASSDEF(BASS_MusicSetAmplify)(HMUSIC handle, DWORD amp);
  438. /* Set a music's amplification level.
  439. handle : Music handle
  440. amp    : Amplification level (0-100) */
  441.  
  442. BOOL BASSDEF(BASS_MusicSetPanSep)(HMUSIC handle, DWORD pan);
  443. /* Set a music's pan seperation.
  444. handle : Music handle
  445. pan    : Pan seperation (0-100, 50=linear) */
  446.  
  447. BOOL BASSDEF(BASS_MusicSetPositionScaler)(HMUSIC handle, DWORD scale);
  448. /* Set a music's "GetPosition" scaler
  449. When you call BASS_ChannelGetPosition, the "row" (HIWORD) will be
  450. scaled by this value. By using a higher scaler, you can get a more
  451. precise position indication.
  452. handle : Music handle
  453. scale  : The scaler (1-256) */
  454.  
  455.  
  456. HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, void *file, DWORD offset, DWORD length, DWORD max, DWORD flags);
  457. /* Load a WAV sample. If you're loading a sample with 3D functionality,
  458. then you should use BASS_GetInfo and BASS_SetInfo to set the default 3D
  459. parameters. You can also use these two functions to set the sample's
  460. default frequency/volume/pan/looping.
  461. mem    : TRUE = Load sample from memory
  462. file   : Filename (mem=FALSE) or memory location (mem=TRUE)
  463. offset : File offset to load the sample from (only used if mem=FALSE)
  464. length : Data length (only used if mem=FALSE, 0=use to end of file)
  465. max    : Maximum number of simultaneous playbacks (1-65535)
  466. flags  : BASS_SAMPLE_xxx flags (only the LOOP/3D/SOFTWARE/OVER_xxx flags are used)
  467. RETURN : The loaded sample's handle (NULL=error) */
  468.  
  469. void* BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD max, DWORD flags);
  470. /* Create a sample. This function allows you to generate custom samples, or
  471. load samples that are not in the WAV format. A pointer is returned to the
  472. memory location at which you should write the sample's data. After writing
  473. the data, call BASS_SampleCreateDone to get the new sample's handle.
  474. length : The sample's length (in samples, NOT bytes)
  475. freq   : default sample rate
  476. max    : Maximum number of simultaneous playbacks (1-65535)
  477. flags  : BASS_SAMPLE_xxx flags
  478. RETURN : Memory location to write the sample's data (NULL=error) */
  479.  
  480. HSAMPLE BASSDEF(BASS_SampleCreateDone)();
  481. /* Finished creating a new sample.
  482. RETURN : The new sample's handle (NULL=error) */
  483.  
  484. void BASSDEF(BASS_SampleFree)(HSAMPLE handle);
  485. /* Free a sample's resources.
  486. handle : Sample handle */
  487.  
  488. BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info);
  489. /* Retrieve a sample's current default attributes.
  490. handle : Sample handle
  491. info   : Pointer to store sample info */
  492.  
  493. BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, BASS_SAMPLE *info);
  494. /* Set a sample's default attributes.
  495. handle : Sample handle
  496. info   : Sample info, only the freq/volume/pan/3D attributes and
  497.          looping/override method flags are used */
  498.  
  499. HCHANNEL BASSDEF(BASS_SamplePlay)(HSAMPLE handle);
  500. /* Play a sample, using the sample's default attributes.
  501. handle : Handle of sample to play
  502. RETURN : Handle of channel used to play the sample (NULL=error) */
  503.  
  504. HCHANNEL BASSDEF(BASS_SamplePlayEx)(HSAMPLE handle, DWORD start, int freq, int volume, int pan, BOOL loop);
  505. /* Play a sample, using specified attributes.
  506. handle : Handle of sample to play
  507. start  : Playback start position (in samples, not bytes)
  508. freq   : Playback rate (-1=default)
  509. volume : Volume (-1=default, 0=silent, 100=max)
  510. pan    : Pan position (-101=default, -100=left, 0=middle, 100=right)
  511. loop   : TRUE = Loop sample (-1=default)
  512. RETURN : Handle of channel used to play the sample (NULL=error) */
  513.  
  514. HCHANNEL BASSDEF(BASS_SamplePlay3D)(HSAMPLE handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
  515. /* Play a 3D sample, setting it's 3D position, orientation and velocity.
  516. handle : Handle of sample to play
  517. pos    : position of the sound (NULL = x/y/z=0.0)
  518. orient : orientation of the sound, this is irrelevant if it's an
  519.          omnidirectional sound source (NULL = x/y/z=0.0)
  520. vel    : velocity of the sound (NULL = x/y/z=0.0)
  521. RETURN : Handle of channel used to play the sample (NULL=error) */
  522.  
  523. HCHANNEL BASSDEF(BASS_SamplePlay3DEx)(HSAMPLE handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel, DWORD start, int freq, int volume, BOOL loop);
  524. /* Play a 3D sample, using specified attributes.
  525. handle : Handle of sample to play
  526. pos    : position of the sound (NULL = x/y/z=0.0)
  527. orient : orientation of the sound, this is irrelevant if it's an
  528.          omnidirectional sound source (NULL = x/y/z=0.0)
  529. vel    : velocity of the sound (NULL = x/y/z=0.0)
  530. start  : Playback start position (in samples, not bytes)
  531. freq   : Playback rate (-1=default)
  532. volume : Volume (-1=default, 0=silent, 100=max)
  533. loop   : TRUE = Loop sample (-1=default)
  534. RETURN : Handle of channel used to play the sample (NULL=error) */
  535.  
  536. BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle);
  537. /* Stops all instances of a sample. For example, if a sample is playing
  538. simultaneously 3 times, calling this function will stop all 3 of them,
  539. which is obviously simpler than calling BASS_ChannelStop() 3 times.
  540. handle : Handle of sample to stop */
  541.  
  542.  
  543. HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD flags, STREAMPROC *proc);
  544. /* Create a user sample stream.
  545. freq   : Stream playback rate
  546. flags  : BASS_SAMPLE_xxx flags (only the 8BITS/MONO/3D flags are used)
  547. proc   : User defined stream writing function
  548. RETURN : The created stream's handle (NULL=error) */
  549.  
  550. HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, void *file, DWORD offset, DWORD length, DWORD flags);
  551. /* Create a sample stream from an MP3 or WAV file.
  552. mem    : TRUE = Stream file from memory
  553. file   : Filename (mem=FALSE) or memory location (mem=TRUE)
  554. offset : File offset of the stream data
  555. length : File length (0=use whole file if mem=FALSE)
  556. flags  : BASS_SAMPLE_3D and/or BASS_MP3_LOWQ flags
  557. RETURN : The created stream's handle (NULL=error) */
  558.  
  559. void BASSDEF(BASS_StreamFree)(HSTREAM handle);
  560. /* Free a sample stream's resources.
  561. stream : Stream handle */
  562.  
  563. BOOL BASSDEF(BASS_StreamPlay)(HSTREAM handle, BOOL flush, DWORD flags);
  564. /* Play a sample stream, optionally flushing the buffer first.
  565. handle : Handle of stream to play
  566. flush  : Flush buffer contents. If you stop a stream and then want to
  567.          continue it from where it stopped, don't flush it. Flushing
  568.          a file stream causes it to restart from the beginning.
  569. flags  : BASS_SAMPLE_xxx flags (only affects file streams, and only the
  570.          LOOP flag is used) */
  571.  
  572.  
  573. BOOL BASSDEF(BASS_CDInit)(char *drive);
  574. /* Initialize the CD functions, must be called before any other CD
  575. functions. The volume is initially set to 100 (the maximum), use
  576. BASS_ChannelSetAttributes() to adjust it.
  577. drive  : The CD drive, for example: "d:" (NULL=use default drive) */
  578.  
  579. void BASSDEF(BASS_CDFree)();
  580. /* Free resources used by the CD */
  581.  
  582. BOOL BASSDEF(BASS_CDInDrive)();
  583. /* Check if there is a CD in the drive. */
  584.  
  585. BOOL BASSDEF(BASS_CDPlay)(DWORD track, BOOL loop);
  586. /* Play a CD track.
  587. track  : Track number to play (1=first)
  588. loop   : TRUE = Loop the track */
  589.  
  590.  
  591. /* A "channel" can be a playing sample (HCHANNEL), a MOD music (HMUSIC),
  592. a sample stream (HSTREAM), or the CD (CDCHANNEL). The following
  593. functions can be used with one or more of these channel types. */
  594.  
  595. BOOL BASSDEF(BASS_ChannelIsActive)(DWORD handle);
  596. /* Check if a channel is active (playing).
  597. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL) */
  598.  
  599. DWORD BASSDEF(BASS_ChannelGetFlags)(DWORD handle);
  600. /* Get some info about a channel.
  601. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM)
  602. RETURN : BASS_SAMPLE_xxx flags (0xffffffff=error) */
  603.  
  604. BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
  605. /* Stop a channel.
  606. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL) */
  607.  
  608. BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
  609. /* Pause a channel.
  610. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL) */
  611.  
  612. BOOL BASSDEF(BASS_ChannelResume)(DWORD handle);
  613. /* Resume a paused channel.
  614. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL) */
  615.  
  616. BOOL BASSDEF(BASS_ChannelSetAttributes)(DWORD handle, int freq, int volume, int pan);
  617. /* Update a channel's attributes. The actual setting may not be exactly
  618. as specified, depending on the accuracy of the device and drivers.
  619. NOTE: Only the volume can be adjusted for the CD "channel", but not all
  620. soundcards allow controlling of the CD volume level.
  621. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  622. freq   : Playback rate (-1=leave current)
  623. volume : Volume (-1=leave current, 0=silent, 100=max)
  624. pan    : Pan position (-101=current, -100=left, 0=middle, 100=right)
  625.          panning has no effect on 3D channels */
  626.  
  627. BOOL BASSDEF(BASS_ChannelGetAttributes)(DWORD handle, DWORD *freq, DWORD *volume, int *pan);
  628. /* Retrieve a channel's attributes. Only the volume is available for
  629. the CD "channel" (if allowed by the soundcard/drivers).
  630. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  631. freq   : Pointer to store playback rate (NULL=don't retrieve it)
  632. volume : Pointer to store volume (NULL=don't retrieve it)
  633. pan    : Pointer to store pan position (NULL=don't retrieve it) */
  634.  
  635. BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, int outvol);
  636. /* Set a channel's 3D attributes.
  637. handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  638. mode   : BASS_3DMODE_xxx mode (-1=leave current setting)
  639. min    : minimum distance, volume stops increasing within this distance (<0.0=leave current)
  640. max    : maximum distance, volume stops decreasing past this distance (<0.0=leave current)
  641. iangle : angle of inside projection cone in degrees (360=omnidirectional, -1=leave current)
  642. oangle : angle of outside projection cone in degrees (-1=leave current)
  643.          NOTE: iangle & oangle must both be set in a single call
  644. outvol : delta-volume outside the projection cone (0=silent, 100=same as inside)
  645. The iangle/oangle angles decide how wide the sound is projected around the
  646. orientation angle. Within the inside angle the volume level is the channel
  647. level as set with BASS_ChannelSetAttributes, from the inside to the outside
  648. angles the volume gradually changes by the "outvol" setting. */
  649.  
  650. BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, DWORD *outvol);
  651. /* Retrieve a channel's 3D attributes.
  652. handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  653. mode   : BASS_3DMODE_xxx mode (NULL=don't retrieve it)
  654. min    : minumum distance (NULL=don't retrieve it)
  655. max    : maximum distance (NULL=don't retrieve it)
  656. iangle : angle of inside projection cone (NULL=don't retrieve it)
  657. oangle : angle of outside projection cone (NULL=don't retrieve it)
  658.          NOTE: iangle & oangle must both be retrieved in a single call
  659. outvol : delta-volume outside the projection cone (NULL=don't retrieve it) */
  660.  
  661. BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
  662. /* Update a channel's 3D position, orientation and velocity. The velocity
  663. is only used to calculate the doppler effect.
  664. handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  665. pos    : position of the sound (NULL=leave current)
  666. orient : orientation of the sound, this is irrelevant if it's an
  667.          omnidirectional sound source (NULL=leave current)
  668. vel    : velocity of the sound (NULL=leave current) */
  669.  
  670. BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
  671. /* Retrieve a channel's current 3D position, orientation and velocity.
  672. handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  673. pos    : position of the sound (NULL=don't retrieve it)
  674. orient : orientation of the sound, this is irrelevant if it's an
  675.          omnidirectional sound source (NULL=don't retrieve it)
  676. vel    : velocity of the sound (NULL=don't retrieve it) */
  677.  
  678. BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, DWORD pos);
  679. /* Set the current playback position of a channel.
  680. handle : Channel handle (HCHANNEL/HMUSIC, or CDCHANNEL)
  681. pos    : the position
  682.     if HCHANNEL: position in bytes
  683.     if HMUSIC: LOWORD=order HIWORD=row ... use MAKELONG(order,row)
  684.     if CDCHANNEL: position in milliseconds from start of track */
  685.  
  686. DWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle);
  687. /* Get the current playback position of a channel.
  688. handle : Channel handle (HCHANNEL/HMUSIC/HSTREAM, or CDCHANNEL)
  689. RETURN : the position (0xffffffff=error)
  690.     if HCHANNEL: position in bytes
  691.     if HMUSIC: LOWORD=order HIWORD=row (see BASS_MusicSetPositionScaler)
  692.     if HSTREAM: total bytes played since the stream was last flushed
  693.     if CDCHANNEL: position in milliseconds from start of track */
  694.  
  695. DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
  696. /* Calculate a channel's current output level.
  697. handle : Channel handle (HMUSIC/HSTREAM)
  698. RETURN : LOWORD=left level (0-128) HIWORD=right level (0-128) (0xffffffff=error) */
  699.  
  700. HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, DWORD param, SYNCPROC *proc);
  701. /* Setup a sync on a channel. Multiple syncs may be used per channel.
  702. handle : Channel handle (currently there are only HMUSIC syncs)
  703. type   : Sync type (BASS_SYNC_xxx type & flags)
  704. param  : Sync parameters (see the BASS_SYNC_xxx type description)
  705. proc   : User defined callback function
  706. RETURN : Sync handle (NULL=error) */
  707.  
  708. BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
  709. /* Remove a sync from a channel
  710. handle : Channel handle (HMUSIC)
  711. sync   : Handle of sync to remove */
  712.  
  713. BOOL BASSDEF(BASS_ChannelSetEAXMix)(DWORD handle, float mix);
  714. /* Set the wet(reverb)/dry(no reverb) mix ratio on the channel. By default
  715. the distance of the sound from the listener is used to calculate the mix.
  716. NOTE: The channel must have 3D functionality enabled for the EAX environment
  717. to have any affect on it.
  718. handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  719. mix    : The ratio (0.0=reverb off, 1.0=max reverb, -1.0=let EAX calculate
  720.          the reverb mix based on the distance) */
  721.  
  722. BOOL BASSDEF(BASS_ChannelGetEAXMix)(DWORD handle, float *mix);
  723. /* Get the wet(reverb)/dry(no reverb) mix ratio on the channel.
  724. handle : Channel handle (HCHANNEL/HSTREAM/HMUSIC)
  725. mix    : Pointer to store the ratio at */
  726.  
  727. #ifdef __cplusplus
  728. }
  729. #endif
  730.  
  731. #endif
  732.